﻿using System.Collections.Generic;
using System.ComponentModel;

namespace RobotGerchik.DataClass.BaseTransaqCalss
{
    public class MoneyPosition : INotifyPropertyChanged
    {
        #region Private
        private string _client;
        private List<int> _market;
        private string _register;
        private string _asset;
        private string _shortname;
        private double _saldoin;
        private double _bought;
        private double _sold;
        private double _saldo;
        private double _ordbuy;
        private double _ordbuycond;
        private double _comission; 
        #endregion

        #region Public
        /// <summary>
        /// Идентификатор клиента
        /// </summary>
        public string Client
        {
            get { return _client; }
            set
            {
                if (_client != value)
                {
                    _client = value;
                    RaisePropertyChanged("Client");
                }
            }
        }

        /// <summary>
        /// Внутренний код рынка
        /// </summary>
        public List<int> Market
        {
            get { return _market; }
            set
            {
                
                if (_market != value)
                {
                    _market = value;
                    RaisePropertyChanged("Market");
                }
            }
        }

        /// <summary>
        /// Регистр учета
        /// </summary>
        public string Register
        {
            get { return _register; }
            set
            {
                if (_register != value)
                {
                    _register = value;
                    RaisePropertyChanged("Register");
                }
            }
        }

        /// <summary>
        /// Код вида средств
        /// </summary>
        public string Asset
        {
            get { return _asset; }
            set
            {
                if (_asset != value)
                {
                    _asset = value;
                    RaisePropertyChanged("Asset");
                }
            }
        }

        /// <summary>
        /// Наименование вида средств
        /// </summary>
        public string Shortname
        {
            get { return _shortname; }
            set
            {
                if (_shortname != value)
                {
                    _shortname = value;
                    RaisePropertyChanged("Shortname");
                }
            }
        }

        /// <summary>
        /// Входящий остаток
        /// </summary>
        public double Saldoin
        {
            get { return _saldoin; }
            set
            {
                if (_saldoin != value)
                {
                    _saldoin = value;
                    RaisePropertyChanged("Saldoin");
                }
            }
        }

        /// <summary>
        /// Куплено
        /// </summary>
        public double Bought
        {
            get { return _bought; }
            set
            {
                if (_bought != value)
                {
                    _bought = value;
                    RaisePropertyChanged("Bought");
                }
            }
        }

        /// <summary>
        /// Продано
        /// </summary>
        public double Sold
        {
            get { return _sold; }
            set
            {
                if (_sold != value)
                {
                    _sold = value;
                    RaisePropertyChanged("Sold");
                }
            }
        }

        /// <summary>
        /// Текущее сальдо
        /// </summary>
        public double Saldo
        {
            get { return _saldo; }
            set
            {
                if (_saldo != value)
                {
                    _saldo = value;
                    RaisePropertyChanged("Saldo");
                }
            }
        }

        /// <summary>
        /// В заявках на покупку + комиссия
        /// </summary>
        public double Ordbuy
        {
            get { return _ordbuy; }
            set
            {
                if (_ordbuy != value)
                {
                    _ordbuy = value;
                    RaisePropertyChanged("Ordbuy");
                }
            }
        }

        /// <summary>
        /// В условных заявках на покупку
        /// </summary>
        public double Ordbuycond
        {
            get { return _ordbuycond; }
            set
            {
                if (_ordbuycond != value)
                {
                    _ordbuycond = value;
                    RaisePropertyChanged("Ordbuycond");
                }
            }
        }

        /// <summary>
        /// Сумма списанной комиссии
        /// </summary>
        public double Comission
        {
            get { return _comission; }
            set
            {
                if (_comission != value)
                {
                    _comission = value;
                    RaisePropertyChanged("Comission");
                }
            }
        } 
        #endregion

        #region event PropertyChangedEventHandler

        public event PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
